<template>
  <div class="index-box">
      <div class="title">
          <span>邻居点转账列表</span>
      </div>
      <div class="index-list-box">  
        <template>
                <el-table :data="merchandiseList"
                        border
                        style="width: 100%">
                <el-table-column type="index"
                                label="序号"
                                 align="center">
                </el-table-column>
                <el-table-column prop="transfer_user_id"
                                label="转账会员ID"
                                 align="center"> 
                </el-table-column>
                <el-table-column prop="transfer_user_name"
                                label="转账会员昵称"
                                 align="center">
                </el-table-column>
                <el-table-column prop="receipt_user_id"
                                label="到账会员ID"
                                 align="center">
                </el-table-column>
                <el-table-column prop="receipt_user_name"
                                label="到账会员昵称"
                                 align="center">
                </el-table-column>
                <el-table-column prop="receipt_user_mobile"
                                label="手机号"
                                 align="center">
                </el-table-column>
                <el-table-column prop='money'
                                label="转邻居点"
                                 align="center">
                </el-table-column>
                <el-table-column prop='add_time'
                                label="转账时间"
                                 align="center">
                </el-table-column>
                <el-table-column fixed="right"
                                label="操作"
                                width="300" align="center">
                    <template slot-scope="scope">
                        <el-button size="mini"
                                    @click="getoperateTransfer(scope.$index, scope.row,1,0)" v-if="scope.row.status != 1 && scope.row.status != 2">审核通过</el-button>
                        <el-button size="mini"
                                    @click="getoperateTransfer(scope.$index, scope.row,2,0)" v-if="scope.row.status != 1 && scope.row.status != 2">审核不通过</el-button>
                        <el-button size="mini"
                                    @click="getoperateTransfer(scope.$index, scope.row,0,1)">删除</el-button>
                    </template>
                </el-table-column>
                </el-table>
            </template>
      </div>
      <!-- 分页器 -->
      <div class="current">
        <div class="block">
          <el-pagination
            @size-change="handleSizeChange"
            @current-change="handleCurrentChange"
            :page-size="10"
            :total="total"
          >
          </el-pagination>
        </div>
      </div>
  </div>
</template>

<script>
// 这里可以导入其他文件（比如：组件，工具js，第三方插件js，json文件，图片文件等等）
// 例如：import 《组件名称》 from '《组件路径》';
import {getfindList, getoperateTransfer} from "@/api/PropertyManagement";
export default {
// import引入的组件需要注入到对象中才能使用
  components: {},
  data() {
    // 这里存放数据
    return {
        merchandiseList:[],
        supplierid:'',
        value: '',
        date: '',
        total: 0, // 用户总条数
        pagesize: 10, //每页显示多少条，默认为10条
        pageNo: 1, // 当前页码，默认为第一页
    }
  },
  // 监听属性 类似于data概念
  computed: {},
  // 监控data中的数据变化
  watch: {},
  // 生命周期 - 创建完成（可以访问当前this实例）
  created() {

  },
  // 生命周期 - 挂载完成（可以访问DOM元素）
  mounted() {
    this.getfindList()
  },
  beforeCreate() {}, // 生命周期 - 创建之前
  beforeMount() {}, // 生命周期 - 挂载之前
  beforeUpdate() {}, // 生命周期 - 更新之前
  updated() {}, // 生命周期 - 更新之后
  beforeDestroy() {}, // 生命周期 - 销毁之前
  destroyed() {}, // 生命周期 - 销毁完成
  activated() {},
  // 方法集合
  methods: {
    // 获取邻居点转账列表
      getfindList(){
        let data = {
          pageNo: this.pageNo,
          pagesize: this.pagesize,
          requestParam:this.seachname
        }
        getfindList(data).then(res => {
          this.merchandiseList = res.rows
          this.pageNo = res.pageNo
          this.pagesize = res.pageSize
          this.total = res.total
        })
      },
      handleSizeChange(val) {
        this.pagesize = val;
        this.getfindList();
      },
      handleCurrentChange(val) {
        this.pageNo = val;
        this.getfindList();
      },
      // 邻居点审核跟删除
      getoperateTransfer(index,row,status,show){
        let data = {}
        if(show == 0){
          data.id = row.id
          data.status = status
          getoperateTransfer(data).then(res => {
            this.getfindList()
          })
        }else if(show == 1){
          data.id = row.id
          data.isDelete = 1
          getoperateTransfer(data).then(res => {
            this.getfindList()
          })
        }
      }
  } // 如果页面有keep-alive缓存功能，这个函数会触发
}
</script>
<style lang='scss' scoped>
//@import url(); 引入公共css类
.index-box{
    width: 100%;
    .title{
        width: 100%;
        padding:20px 40px 20px 40px;
        box-sizing: border-box;
        span{
            font-size: 20px;
            font-weight: bold;
        }
    }
    .index-middlebox{
        width: 100%;
        padding-left: 40px;
        box-sizing: border-box;
        display: flex;
        align-items: center;
        box-sizing: border-box;
        .middle-item{
            span{
                display: inline-block;
                font-size: 14px;
                padding-right: 15px;
                padding-left: 30px;
                box-sizing: border-box;
            }
            .productname-input{
                width: 200px;
            }
            .search{
                width: 100px;
                margin-left:20px;
            }
            .search2{
                width: 120px;
                margin-left:20px;
            }
        }
    }
    .index-list-box{
        width: 100%;
        padding: 30px 40px;
        box-sizing: border-box;
    }
    .current {
      .block {
        text-align: center;
      }
    }
}
</style>
